Fedora 26
Sponsored Link

Docker : Add Images
2017/07/30
 
Add Images for Containers.
[1] For exmaple, update official image with installing httpd and add it as a new image for container. The container is generated every time for executing docker run command, so add the latest executed container like follows.
# show images

[root@dlp ~]#
docker images

REPOSITORY                          TAG     IMAGE ID      CREATED      SIZE
registry.fedoraproject.org/fedora   latest  7f17e6b4a386  4 weeks ago  232 MB

# start a Container and install httpd

[root@dlp ~]#
docker run fedora /bin/bash -c "dnf -y upgrade; dnf -y install httpd"

[root@dlp ~]#
docker ps -a | head -2

CONTAINER ID  IMAGE   COMMAND                  CREATED        STATUS                    PORTS  NAMES
95ff208ff0ac  fedora  "/bin/bash -c 'dnf..."   5 minutes ago  Exited (0) 5 minutes ago         hardcore_...

# add the Image

[root@dlp ~]#
docker commit 95ff208ff0ac srv.world/fedora_httpd

sha256:441834eaabe4fa33166faffcef0747020f9626283ddaa229f98204eae7360f41
# show images

[root@dlp ~]#
docker images

REPOSITORY                          TAG         IMAGE ID            CREATED             SIZE
srv.world/fedora_httpd              latest      441834eaabe4        12 seconds ago      478 MB
registry.fedoraproject.org/fedora   latest      7f17e6b4a386        4 weeks ago         232 MB

# Generate a Container from the new image and execute [whereis] to make sure httpd exists

[root@dlp ~]#
docker run srv.world/fedora_httpd /usr/bin/whereis httpd

httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz
 
Tweet